def level_check(one_line_outline):
    if one_line_outline.startswith('# '):
        return 1
    elif one_line_outline.startswith('## '):
        return 2
    elif one_line_outline.startswith('### '):
        return 3
    elif one_line_outline.startswith('#### '):
        return 4
    elif one_line_outline.startswith('##### '):
        return 5
    elif one_line_outline.startswith('###### '):
        return 6

def get_sub_query(section_outline):
    sub_querys = []
    sub_titles = []
    level_1_title,level_2_title = None, None
    for line in section_outline:
        sub_titles.append(line.strip('#').lstrip())
        if level_check(line) == 1:
            level_1_title = line.strip('#').lstrip()
            sub_querys.append(level_1_title)
        elif level_check(line) == 2:
            level_2_title = line.strip('#').lstrip()
            sub_querys.append(f"{level_1_title}::{level_2_title}")
        elif level_check(line) == 3:
            level_3_title = line.strip('#').lstrip()
            sub_querys.append(f"{level_1_title}::{level_2_title}::{level_3_title}")
        elif level_check(line) == 4:
            level_4_title = line.strip('#').lstrip()
            sub_querys.append(f"{level_1_title}::{level_2_title}::{level_3_title}::{level_4_title}")
        elif level_check(line) == 5:
            level_5_title = line.strip('#').lstrip()
            sub_querys.append(f"{level_1_title}::{level_2_title}::{level_3_title}::{level_4_title}::{level_5_title}")
        elif level_check(line) == 6:
            level_6_title = line.strip('#').lstrip()
            sub_querys.append(f"{level_1_title}::{level_2_title}::{level_3_title}::{level_4_title}::{level_5_title}::{level_6_title}")

    return sub_titles,sub_querys